//
//  YZPublishCommunityImgCell.m
//  VET
//
//  Created by YZ on 2018/7/10.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZPublishCommunityImgCell.h"

@interface YZPublishCommunityImgCell()

@property (nonatomic, strong) UIImageView *imgView;

@property (nonatomic, strong) UIImageView *addImgView;

@end

@implementation YZPublishCommunityImgCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame]){
        self.layer.masksToBounds = YES;
        self.layer.borderWidth = 0.5;
        self.layer.borderColor = kColorWithHex(0xFCFCFC).CGColor;
        self.backgroundColor = kColorWithHex(0xFAFAFA);
        [self.contentView addSubview:self.imgView];
        [self.contentView addSubview:self.addImgView];
        
        [self makeContraints];
    }
    return self;
}

- (void)makeContraints
{
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self).insets(UIEdgeInsetsZero);
    }];
    
    [self.addImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(kCurrentDeviceNum(40), kCurrentDeviceNum(40)));
    }];
}

#pragma mark -- setters && getters

- (UIImageView *)imgView
{
    if(!_imgView){
        _imgView = [UIImageView new];
    }
    return _imgView;
}

- (UIImageView *)addImgView
{
    if(!_addImgView){
        _addImgView = [UIImageView new];
    }
    return _addImgView;
}

- (void)setModel:(YZPublishCommunityImgModel *)model
{
    _model = model;
    self.imgView.image = model.img;
    self.addImgView.image = model.addImg;
}
@end
